package com.hue.springbootquartz.job;

import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.scheduling.quartz.QuartzJobBean;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * 自定义需要执行的任务
 */
public class MyJob extends QuartzJobBean {
    @Override
    protected void executeInternal(JobExecutionContext jobExecutionContext) throws JobExecutionException {
        Object msg = jobExecutionContext.getJobDetail().getJobDataMap().get("msg");
//        System.out.println("current time:" + new SimpleDateFormat("yyyy-MM-dd hh:mm:ss").format(new Date()) + "---" + msg);

//        System.out.println(this);

        System.out.println(jobExecutionContext.getJobDetail());
    }
}
